{% extends "base.html" %}

{% block body %}
    <table class="bordered-table zebra-striped">
        <thead>
          <tr>
            <th style="width: 30px;">序号</th>
            <th style="width: 190px;">标题</th>
            <th>介绍</th>
          </tr>
        </thead>
        <tbody>
          {% for i,entry in enumerate(entries) %}
          <tr>
            <td>#{{counts-i}}</td>
            <td><a href="/{{ entry.slug }}">{{entry.title}}</a></td>
            <td>{{entry.info[ :100]}}</td>
          </tr>
          {% end %}
        </tbody>
    </table>
<div class="pagination">
  <ul>
{% if pages>11 %}
     <li class="prev disabled"><a href="#">&larr; Previous</a></li>
    {% for i in range(1,6) %}
        {% if i==1 %}
            <li class="active"><a href="#">{{i}}</a></li>
        {% elif i==1 %}
            <li><a href="/">{{i}}</a></li>
        {% else %}
            <li><a href="/page/{{i}}">{{i}}</a></li>
        {% end %}
    {% end %}
    <li class="disabled"><a href="#">...</a></li>
    {% for i in range(pages-4,pages+1) %}
         <li><a href="/page/{{i}}">{{i}}</a></li>
    {% end %}
    <li class="next"><a href="/page/2">Next &rarr;</a></li>
{% else %}
    <li class="prev disabled"><a href="#">&larr; Previous</a></li>
    {% for i in range(pages) %}
        {% if i==0 %}
            <li class="active"><a href="/">{{i+1}}</a></li>
        {% else %}
            <li><a href="/page/{{i+1}}">{{i+1}}</a></li>
        {% end %}
    {% end %}
    {% if pages==1 %}
        <li class="next disabled"><a href="#">Next &rarr;</a></li>
    {% else %}
        <li class="next"><a href="/page/2">Next &rarr;</a></li>
    {% end %}
{% end %}
  </ul>
</div>
{% end %}
